# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname="wiringx"
pkgver="0_git20191126"
_commitid=8efb38935b92f86f4932d7bb52169694854f307c
pkgrel=1
pkgdesc="modular approach to several GPIO interfaces"
url="https://github.com/wiringX/wiringX"
arch="aarch64 armv7 armhf"
license="MPL-2.0"
options="!check" # no testsuite
makedepends="cmake linux-headers"
subpackages="$pkgname-dev"
source="wiringx-$pkgver.tar.gz::https://github.com/wiringX/wiringX/archive/$_commitid.tar.gz
	fix_time_t.patch
	"
builddir="$srcdir/"wiringX-$_commitid

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS} .
	make
}

package() {
	make DESTDIR="$pkgdir" install
	rm -rf "$pkgdir"/usr/sbin
}

sha512sums="50642c0ec248f15e7a3c4a13fff296331c1e065157c5d36688ca3ee02be0f94668333dd0fe859782736ccccf93380d24d1e58b40f3e74137818da3776742353d  wiringx-0_git20191126.tar.gz
b7751f0396fb90a5550a064006eb5f75ff5835a9e0c7b419abfdb2ec42313ab4bd6365874415a41f4f2cf6e9c778eec72b317e14dfbc439216e21c6bc4f73294  fix_time_t.patch"
